package org.lc.design.samples.case1;

import org.lc.design.samples.case1.factory.ElectronicFactory;
import org.lc.design.samples.case1.factory.impl.AppleFactory;
import org.lc.design.samples.case1.factory.impl.HUAWEIFactory;

import java.util.HashMap;
import java.util.Map;

/**
* 电子产品制造工厂
* @author lc
* @date 2024/3/26
*/
public class ElectronicProductFactory {

    private static final Map<String, ElectronicFactory> map = new HashMap<>();

    static {
        map.put("Apple",new AppleFactory());
        map.put("HUAWEI",new HUAWEIFactory());
    }

    public static ElectronicFactory getElectronicFactory(String brand) {
        return map.get(brand);
    }
}
